<!--  -->
<template>
  <div class='login'>
      <van-nav-bar
  title="登录/注册"
  left-text="返回"
 
  left-arrow
  @click-left="$router.back()"
  
/>
    <van-form @submit="submit">
  <van-field
    v-model="userinfo.name"
    name="用户名"
    label="用户名"
    placeholder="用户名"
    :rules="rules"
  />
  <van-field
    v-model="userinfo.password"
    type="password"
    name="密码"
    label="密码"
    placeholder="密码"
    :rules="mrules"
  />
  <div>
    <van-button square block type="primary" native-type="submit">登录/注册</van-button>
  </div>
</van-form>
  </div>
</template>

<script>
import { mapMutations,mapActions } from "vuex";
export default {
name:'',
  data () {
    return {
        userinfo:{
            name:'',
            password:''
        },
        rules:[{ required: true, message: '请填写用户名' },{pattern:/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/,message: '账号必须包含数字和字母且至少6位以上'}],
        mrules:[{ required: true, message: '请填写密码' },{pattern:/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/,message: '密码必须包含数字和字母且至少6位以上'}],
    };
  },


  computed: {},


  methods: {
      ...mapActions(["getgxinxi"]),
      submit(){
        this.getgxinxi(this.userinfo)
      }
  }
}

</script>
<style lang='less' scoped>
</style>